--- id: TASK-028 title: 'TUI: Persist theme selection across restarts' status: To Do assignee: [] created_date: '2026-06-12 04:21' labels: - tui - enhancement dependencies: [] priority: low ordinal: 28000 --- ## Description Theme resets to `flexoki` every time the TUI starts. Save the selected theme index to a local state file so the last-used theme is restored on next launch. State file location: `~/.local/share/dashboard/tui_state.json` (create dir if needed). Implementation: - On `action_next_theme()`, write `{"theme_idx": N, "page_id": "..."}` to the state file - On `on_mount()`, read the file if it exists and restore `_theme_idx` before applying the theme - Use `json` + `pathlib.Path`; silently ignore missing or malformed state file - A single state file shared with TASK-022 (page persistence) ## Acceptance Criteria - [ ] #1 Selected theme persists after quitting and relaunching the TUI - [ ] #2 Missing or corrupt state file falls back to flexoki without error - [ ] #3 State file is human-readable JSON